/**
 * Copyright (C) 2019-2021 杭州优诗科技有限公司
 *
 * This file is part of UnitSpirit.
 * @author wupingfu
 * @version 1.0.0
 * 
 **/
package com.unitspirit.sample.Annotation;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; 
  
// create a custom Annotation 
@Retention(RetentionPolicy.RUNTIME) 
@interface Annotation { 
  
    // This annotation has two attributes. 
    public String key(); 
  
    public String value(); 
} 
  
// call Annotation for method 
// and pass values for annotation 
@Annotation(key = "GFG", value = "GeeksForGeeks") 
public class AnnotationSample { 
  
    public static void main(String[] args) 
        throws ClassNotFoundException 
    { 
  
        // returns the Class object for this class 
        Class myClass = AnnotationSample.class; 
  
        System.out.println("Class represented by myClass:"
                           + myClass.toString()); 
  
        // Get the annotation 
        // using getAnnotation() method 
        System.out.println( 
            "Annotation of myClass:"
            + myClass.getAnnotation( 
                  Annotation.class)); 
    } 
}